import request from "src/utils/request";
import type {QueryPageParams} from 'src/types/requestParam'

// 获取首页文章列表
export const getArtAll=(params:QueryPageParams)=> {
  return request.fetchPageList(`/post/public/list`, { params: params });
}
//分类文章列表
export const listByCategory=(params:QueryPageParams,category:string)=>{
  return request.fetchPageList(`/post/public/listByCategory/${category}`, { params: params });
}
//标签文章列表
export const listByTag=(params:QueryPageParams,tag:string)=>{
  return request.fetchPageList(`/post/public/listByTag/${tag}`, { params: params });
}
// 获取文章详情
export const getDetail=(id:Number)=> {
  return request.get(`/post/public/view/${id}`);
}

// 获取归档
export const getArchive=()=> {
  return request.get(`/post/public/archive`);
}

// 获取文章详情
export const likePost=(id:Number)=> {
  return request.post(`/post/public/${id}/like`);
}

export default{
    getArtAll,getDetail,likePost,listByCategory,listByTag,getArchive

}